<template>
	<view class="login">
		<view class="bg"></view>
		<image src="@/static/logo_rect.png" class="logo" mode="widthFix"></image>
		<image src="@/static/rule/rule_front.png" class="front-img" mode="widthFix"></image>

		<view class="add-member" @click="showLogin = true">手机号快键登录</view>
		
		<login :showLogin="showLogin" @loginSuccess="loginSuccess" @cancelLogin="showLogin = false" />
	</view>
</template>

<script>
	import EventBusMacro from "@/plugins/EventBus/eventBusMacro.js"
	import {
		ThemeMixin
	} from '@/mixins/theme/xThemeMixin.js'
	// import XLogoBg from '@/components/logoBg/xLogoBg.vue'
	export default {
		mixins: [ThemeMixin],
		components: {
			// XLogoBg,
		},
		data() {
			return {
				userInfo: null,
				showLogin: false,
				scene: '', //进入场景值
				openSubscribe: false, //是否成功订阅
			}
		},
		show() {
			if (this.userInfo && this.userInfo.isPartner) {
				console.log("show")
				uni.navigateBack()
			}
		},
		onLoad(options) {
			this.scene = options?.scene ? options.scene : ''
		},

		methods: {
			loginSuccess() {
				this.showLogin = false
				
				this.userInfo = this.$store.state.userInfo
				this.$events.emit(EventBusMacro.EB_LOGIN_SCUCCESS)

				if (this.scene === this.$TOOLS.LOGIN_SCENE.LS_HOMEPAGE_SCAN_PRIZE_AUTHORIZATION) {
					this.$events.emit(EventBusMacro.EB_HOMEPAGE_SCAN_PRIZE_AUTHORIZATION)
					this.scene = '' //复位
				}
				uni.navigateBack()
			},
			
			
		}
	}
</script>

<style lang="scss" scoped>
	.welcome {
		height: 420rpx;
		display: flex;
		flex-direction: column;
		align-items: center;

		.header {
			font-size: 32rpx;
			font-family: PingFang-SC-Bold;
			font-weight: 600;
			margin-top: 40rpx;
		}

		.title {
			margin-top: 20rpx;
			font-size: 28rpx;
			font-family: PingFang-SC-Bold;
			font-weight: 600;
		}

		.subtitle {
			margin-top: 20rpx;
			font-size: 28rpx;
			font-family: PingFang-SC-Bold;
			font-weight: 600;
		}

		.private-info {
			display: flex;
			align-items: center;
			color: $x-theme-color;
			margin-top: 20rpx;

			.protocol-prefix {
				margin-left: 10rpx;
			}

			.protocol {
				text-decoration: underline;
				text-decoration-color: #515151;
			}
		}

		.btn-launch {
			margin-top: 20rpx;
			width: 700rpx;
		}

	}
</style>

<style lang="scss" scoped>
	.login {
		display: flex;
		flex-direction: column;
		align-items: center;
		height: 100%;

		.bg {
			background: #000;
			position: absolute;
			top: 0;
			left: 0;
			width: 100%;
			height: 100%;
			z-index: -2;
		}

		.logo {
			width: 244rpx;
			position: absolute;
			left: 30rpx;
			top: 80rpx;
			z-index: -1;
		}

		.front-img {
			
			position: absolute;
			right: -40rpx;
			top: 0rpx;
			z-index: -1;
			width: 50%;
			top: -50rpx;
		}


		.add-member {
			margin-top: 480rpx;
			width: 618rpx;
			height: 90rpx;
			background: #EDEDED;
			font-family: PingFang-SC;
			font-size: 32rpx;
			color: #B49370;
			line-height: 90rpx;
			text-align: center;
			border-radius: 45rpx;
		}
		
		.subscribe {
			width: 618rpx;
			margin-top: 80rpx;
			height: 90rpx;
			background: #EDEDED;
			font-family: PingFang-SC;
			color: #B49370;
			line-height: 90rpx;
			text-align: center;
			border-radius: 45rpx;
		}
	}
</style>